import React from "react";

export default function Total(props) {
  return (
    <div style={{display:'flex'}}>
      <div>
        <input
          type="checkbox"
          checked={props.list.every((item) => item.flag)}
          onChange={(e) => props.select(e.target.checked)}
        />
        <span className="sp1">全选</span>
      </div>
      <div className="money div1">
        <p>合计</p>
        <p>以免运费</p>
      </div>
      <div className="money div2">
        <p>￥{props.list.reduce((prev,next)=>prev+(next.flag?next.price*next.count:0),0)}</p>
        <p>已优惠￥200元</p>
      </div>
      <p className="sum">结算</p>
    </div>
  );
}
